<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
       1. jc(4)=24 return 4 * jc(3);
       2. jc(3)=6 return 3 * jc(2);
       3. jc(2)=2 return 2 * jc(1);
       4. jc(1)=1
      */
      function jc(n) {
        if (n === 1) return 1;
        return n * jc(n - 1);
      }
      console.log(jc(4));
    </script>
  </body>
</html>
